
<script>
    function create_active(id,g,row){
        if(row.status ==0){
            var href= GURL(handle,'create?id='+id);
            return '<a href="'+href+'">生成</a>'
        }
        else if(row.status ==1){
            return '正在生成';
        }
        else {
            var href= GURL(handle,'download?id='+id);
            return "<a href='"+href+"'>下载</a>"
        }

    }
    var cid = '<%=ret.cid%>';
    var status_list = {0:'未生成',1:'正在生成',2:'完成[可以下载]'};
    var option = {
        colModel : [
            {label: 'id', name: '_id', width: 250,key:true, editable: false,sortable:false, resize:false,search:true,fixed:true},
            {label: '总数量', name: 'num',width: 80, editable: true, sortable:false,hidden:false,resize:true,fixed:true,search:false},
            {label: '创建时间', name: 'time',width: 180, editable: false, sortable:false,hidden:false,resize:true,fixed:true,search:false,
                formatter:cosjs.jqgrid.timeFormat,
            },
            {label: '状态', name: 'status',width: 180, editable: false, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:'select', edittype:'select', editoptions:{value:status_list},
            },
            {label: '说明', name: 'desc',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:false,search:false},
            {label: '操作', name: '_id', width: 100, editable: false,sortable:false, resize:false,search:false,fixed:true,
                formatter:create_active,
            },
        ],
        afterShowEditForm : function(e){
            $("#num").attr("disabled", true);
        },
    }
    $(document).ready(function () {
        cosjs_create_jqgrid(option,{'cid':cid},{"del":false});
    });
</script>
